import React, { memo } from "react";
import css from './css.module.scss'
import { Row, Col } from 'antd';
import { IMGURL } from '../../services/config'
import { useHistory } from 'react-router-dom';
import { openUrl } from '../../common/utils'
import { Empty } from 'antd';
import { Image } from 'antd';
export default memo(function LookLists(props) {
    const { list } = props
    const history = useHistory();
    const handDetails = (item) => {
        //返回true可以跳转详情 
        if (openUrl(item)) {
            history.push('/newsDetails?' + item.newsId);
        }
    }
    return (
        <div className={css.ar_list}>
            {list.length !== 0 ? <Row gutter={[16, 30]}>
                {list.map((item, index) => {
                    return (
                        <Col span={8} key={item.newsId} onClick={e => handDetails(item)}>
                            <div className={css.wor_item}>
                                {/* <img className={css.item_img} src={IMGURL + item.titleImg} alt='回顾' /> */}
                                <Image
                                    preview={false}
                                    width='100%'
                                    height={180}
                                    src={IMGURL + item.titleImg}
                                />
                                <div className={css.title_box}>
                                    <div className={css.title}> {item.title}</div>
                                </div>
                            </div>
                        </Col>
                    )
                })}
            </Row> : <Empty description='暂无数据' />}
        </div>
    )
})
